/**
 * 浅拷贝
*/
const obj1 = {
  name: '阿里浪',
  arr: [1, [2, 3], 4]
}

const obj2 = {}
obj2.name = '字节浪'

const shllowClone = (target, source) => {
  for (const key in source) {
    // 只拷贝sorce本身的属性，不检查原型链
    if (source.hasOwnProperty(key)) {
      target[key] = source[key]
    }
  }
  return target
}

console.log(shllowClone(obj2, obj1))